package android.javaClasses;

import android.util.Log;

import java.io.DataInputStream;
import java.io.InputStream;

/**
 * Created by IntelliJ IDEA.
 * User: michelle
 * Date: 4/11/11
 * Time: 4:24 PM
 * To change this template use File | Settings | File Templates.
 */
public class Transformer {


    public String inputStreamToString(InputStream inStream) throws Exception {
        StringBuffer sBuffer = null;
        DataInputStream dataIO = null;
        try {
            sBuffer = new StringBuffer();
            dataIO = new DataInputStream(inStream);
            String strLine = null;
            while ((strLine = dataIO.readLine()) != null) {
                sBuffer.append(strLine + "\n");
            }


        } catch(Exception e) {
            Log.e("InputStreamToStringERROR", e.toString());
        } finally {
            dataIO.close();
            inStream.close();
        }
        return sBuffer.toString();

    }


}